import getEnv from '../utils/env'
import request from '../utils/request'

export function getUser<T>() {
  return request<T>({
    url: '/getUser',
    method: 'GET',
    errorMsg: false
  })
}

export function getDeptTree<T>() {
  return request<T[]>({
    baseURL: getEnv('system_baseurl'),
    url: '/user/deptTree',
    method: 'GET'
  })
}

export function upload<T>(data: unknown) {
  return request<T>({
    url: '/upload',
    method: 'POST',
    data,
    requestType: 'blob'
  })
}

export function getAllType<T>(type: number) {
  return request<T[]>({
    url: '/dictionary/' + type,
    method: 'GET',
    errorMsg: false
  })
}
